<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@page import="java.io.FileOutputStream"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.io.File"%>
<%@page import="java.io.OutputStream"%>
<HTML>
<HEAD>
<TITLE>RestFinder - wszystko o restauracjach w twoim mieście!</TITLE>
<META HTTP-EQUIV="Content-Type"
	CONTENT="text/html; charset=windows-1250">
<!-- ImageReady Preload Script (index.psd) -->
<SCRIPT TYPE="text/javascript">
<!--
	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	}

	function changeImages() {
		if (document.images && (preloadFlag == true)) {
			for ( var i = 0; i < changeImages.arguments.length; i += 2) {
				document[changeImages.arguments[i]].src = changeImages.arguments[i + 1];
			}
		}
	}

	var preloadFlag = false;
	function preloadImages() {
		if (document.images) {
			moje_konto = newImage("images/moje_konto.jpg");
			news = newImage("images/news.jpg");
			szukaj = newImage("images/szukaj.jpg");
			top = newImage("images/top.jpg");
			wyloguj = newImage("images/wyloguj.jpg");
			preloadFlag = true;
		}
	}
// -->
</SCRIPT>
<!-- End Preload Script -->
<link href="css/styles.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0
	MARGINHEIGHT=0 ONLOAD="preloadImages();">
	<center>

		<!-- ImageReady Slices (index.psd) -->
		<TABLE WIDTH=775 BORDER=0 CELLPADDING=0 CELLSPACING=0>
			<TR>
				<TD COLSPAN=5><IMG SRC="images/m1.jpg" WIDTH=313 HEIGHT=93
					ALT="">
				</TD>
				<TD COLSPAN=2><A HREF="mojekonto.htm"
					ONMOUSEOVER="window.status='home page'; changeImages('home_page', 'images/moje_konto-over.jpg'); return true;"
					ONMOUSEOUT="window.status=''; changeImages('home_page', 'images/moje_konto.jpg'); return true;">
						<IMG NAME="home_page" SRC="images/moje_konto.jpg" WIDTH=95
						HEIGHT=93 BORDER=0 ALT="home page"> </A>
				</TD>
				<TD COLSPAN=2><A HREF="news.htm"
					ONMOUSEOVER="window.status='about us'; changeImages('about_us', 'images/news-over.jpg'); return true;"
					ONMOUSEOUT="window.status=''; changeImages('about_us', 'images/news.jpg'); return true;">
						<IMG NAME="about_us" SRC="images/news.jpg" WIDTH=92 HEIGHT=93
						BORDER=0 ALT="about us"> </A>
				</TD>
				<TD COLSPAN=3><A HREF="szukaj.htm"
					ONMOUSEOVER="window.status='location'; changeImages('location', 'images/szukaj-over.jpg'); return true;"
					ONMOUSEOUT="window.status=''; changeImages('location', 'images/szukaj.jpg'); return true;">
						<IMG NAME="location" SRC="images/szukaj.jpg" WIDTH=83 HEIGHT=93
						BORDER=0 ALT="location"> </A>
				</TD>
				<TD COLSPAN=3><A HREF="logout.htm"
					ONMOUSEOVER="window.status='contacts'; changeImages('contacts', 'images/wyloguj-over.jpg'); return true;"
					ONMOUSEOUT="window.status=''; changeImages('contacts', 'images/wyloguj.jpg'); return true;">
						<IMG NAME="contacts" SRC="images/wyloguj.jpg" WIDTH=92 HEIGHT=93
						BORDER=0 ALT="contacts"> </A>
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=93 ALT="">
				</TD>
			</TR>
			<TR>
				<TD COLSPAN=8 ROWSPAN=2><IMG SRC="images/m2.jpg" WIDTH=425
					HEIGHT=228 ALT="">
				</TD>
				<TD COLSPAN=9><IMG SRC="images/m3index.jpg" WIDTH=350
					HEIGHT=119 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=119 ALT="">
				</TD>
			</TR>
			<TR>
				<TD WIDTH=319 HEIGHT=109 COLSPAN=7 align="left" valign="top"
					class="text2">Zalogowany jako: <security:authentication
						property="principal.username" /> <br />
					<h1>
						<c:out value="${restaurant.name }" />
					</h1>
				</TD>
				<TD COLSPAN=2><IMG SRC="images/spacer.gif" WIDTH=31 HEIGHT=109
					ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=109 ALT="">
				</TD>
			</TR>




			<TD><IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=47 ALT="">
			</TD>
			</TR>
			<TR>
				<TD><IMG SRC="images/spacer.gif" WIDTH=61 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=144 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=44 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=35 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=29 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=89 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=6 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=17 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=75 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=7 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=29 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=47 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=67 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=6 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=88 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=8 HEIGHT=1 ALT="">
				</TD>
				<TD><IMG SRC="images/spacer.gif" WIDTH=23 HEIGHT=1 ALT="">
				</TD>
				<TD></TD>
			</TR>
		</TABLE>
		
		<div class="tabbed-area">
			<div class="box-wrap">
			<div id="box-one" style="height: 340px; position: relative; top:10px; overflow: scroll;">
				Ulubione:&nbsp;&nbsp;&nbsp;&nbsp;Śledzenie:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ocena:<br/>	
				<c:if test="${favouriteChecked == true}"> <a href="favouriteRestuarantId=${restaurant.id}.htm" ><img alt="Dodaj do ulubionych" src="images/serce.gif" /></a> </c:if>	
				<c:if test="${favouriteChecked == false}"> <a href="favouriteRestuarantId=${restaurant.id}.htm" ><img alt="Usuń do ulubionych" src="images/serce2.gif" onmouseover="this.src='images/serce.gif'" 
onmouseout="this.src='images/serce2.gif'"></a> </c:if>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <c:if test="${followChecked == true}"><a href="followRestaurantId=${restaurant.id}.htm" ><img alt="Sledź restaurację" style="position:relative;top:5px;" src="images/lupa.jpg" > </a>
</c:if> 
<c:if test="${followChecked == false}"><a href="followRestaurantId=${restaurant.id}.htm" ><img alt="Sledź restaurację" style="position:relative;top:5px;" src="images/lupa2.jpg" onmouseover="this.src='images/lupa.jpg'" onmouseout="this.src='images/lupa2.jpg'" > </a></c:if> 
<form style="position:relative; top:-25px; left:120px;" name="rate" action="rateRestaurantId=${restaurant.id}.htm" method="POST">
<input type="radio" name="group1"  value="brak oceny"> brak oceny
<input type="radio" name="group1" value="1" <c:if test="${rate.rate == 1}"> checked </c:if>> 1
<input type="radio" name="group1" value="2" <c:if test="${rate.rate == 2}"> checked </c:if>> 2
<input type="radio" name="group1" value="3" <c:if test="${rate.rate == 3}"> checked </c:if>> 3
<input type="radio" name="group1" value="4" <c:if test="${rate.rate == 4}"> checked </c:if>> 4
<input type="radio" name="group1" value="5" <c:if test="${rate.rate == 5}"> checked </c:if>> 5
<input type="submit" class="button"	value="Oceń">

</form>
					
					<h3 style="text-align: center">Informacje o restauracji:</h3>
					<table>
							<tr>
								<td colspan="2"><span class="text1"
									style="text-align: right">Dane:</span>
								<td />


							</tr>
							<tr>
								<td colspan="5">Nazwa : <c:out value="${restaurant.name}" /></td>
								<td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/>
								<td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/>
								<td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/>
								
<!-- 								<td >Logo :</td> -->
							</tr>
							<tr>
								<td colspan="5" valign="top">Opis : <c:out value="${restaurant.description}" /></td>
								<td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/>
								<td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/>
								<td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/>
								
<%-- 								<td><img src="${logosource}" alt="alt text for image" /></td> --%>
							</tr>
							<tr>
								<td>Adres : <c:out value="${restaurant.street}" /></td>
								<td/>
							</tr>
							<tr>
								<td>Miasto : <c:out value="${restaurant.city}" /></td>
								<td/>
							</tr>
							<tr>
								<td>Kraj : <c:out value="${restaurant.country}" /></td>
								<td/>
							</tr>
							<tr>
								<td>Kod pocztowy : <c:out value="${restaurant.postal_code}" /></td>
								<td/>
							</tr>
							<tr>
								<td>Telefon : <c:out value="${restaurant.telephone}" /></td>
								<td/>
							</tr>
							
					</table>
					<table>
					<tr><td colspan="2"><span class="text1"
									style="text-align: right">Tagi:</span></tr>
					<tr>
					<td colspan="3">
					<c:out value="${tagi}" /></td>
					</tr>
									
					</table>		
					
			</div>
			</div>
		</div>
		<br/>
		<br/>
		<div class="tabbed-area">
		<div class="box-wrap" style="overflow:scroll;width: 770px; height:400px;">

		<h3 style="text-align: center">Komentarze:</h3>
		<c:if test="${fn:length(commentList) > 0}">
						<table cellpadding="5">
							<c:forEach items="${commentList}" var="comment" varStatus="status">
								<tr>
								<td><span style="font-size:14px;"><c:out value="${comment.username}" /> napisał: &nbsp; &nbsp; &nbsp; &nbsp; <c:out value="${comment.date}" /></span></td>
								</tr>
								<tr>
								<td><span style="font-size:12px;font-style:italic;"><c:out value="${comment.comment}" /></span></td>
								<tr>
							</c:forEach>
						</table>
					</c:if>
		</div></div>
				<br/>
		<br/>
		<div class="tabbed-area">
		<div class="box-wrap">

		<h3 style="text-align: center">Dodaj komentarz:</h3>
		<form:form action="addcommentrestaurantid=${restaurant.id }.htm" commandName="comment" method="POST">
		<table>
							<tr>
								<td>Login :</td>
								<td><c:out value="${user.username }" /></td>
							</tr>
							<tr>
								<td>Komentarz :</td>
								<td><form:textarea cols="50" rows="5" path="comment" /></td>
								<td><span style="color:red"><c:out value="${passwordError}"/></span></td>
							</tr>
							<tr>
								<td colspan="2"><input type="submit" class="button" value="Dodaj komentarz">
								</td>
							</tr>
		</form:form>
		</div>
		
		</div>
		<br/><br/>

		<table>
			<tr>
				<TD WIDTH=775 HEIGHT=47 COLSPAN=17 align="center" valign="middle"
					BGCOLOR=#979076 class="text4"></TD>
			</tr>
		</table>
	</center>
</BODY>

</HTML>
